package com.ytrsoft.entity;

import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.persistence.*;

import java.util.List;

@Schema(description = "角色类")
@Entity
public class Role extends BaseEntity {

    @Schema(description = "编码")
    @Column(nullable = false, unique = true)
    private String code;

    @Schema(description = "名称")
    private String name;

    @Schema(description = "关联用户")
    @OneToMany(mappedBy = "role")
    private List<User> users;

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getCode() {
        return code;
    }

    public void setCode(String code) {
        this.code = code;
    }

    public List<User> getUsers() {
        return users;
    }

    public void setUsers(List<User> users) {
        this.users = users;
    }
}
